package com.dmp.logger;

import java.io.*;

public class LocationLogger implements ILogger,Serializable{
	private static final long serialVersionUID = 1L;
	private String filePath = System.getProperty("user.dir") + "/";
	public LocationLogger(){}
	public LocationLogger(String filePath){
		this.filePath = filePath;
	}
	@Override
	public void log(String content) {
		this.write(filePath + Thread.currentThread().getName() + ".log", content);
	}
	private void write(String file, String conent) {     
        BufferedWriter out = null;     
        try {     
            out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file, true)));
            out.write(conent);
            out.newLine();
        } catch (Exception e) {     
            e.printStackTrace();     
        } finally {     
            try {     
                if(out != null){  
                    out.close();     
                }  
            } catch (IOException e) {     
                e.printStackTrace();     
            }     
        }     
    }  

}
